import 'dart:developer';

import 'package:get/get.dart';
import 'package:guochaoapp/config/container.dart';
import 'package:guochaoapp/controller/mine/mine_controller.dart';
import 'package:guochaoapp/r.dart';
import 'package:guochaoapp/routes/app_pages.dart';
import 'package:guochaoapp/services/user_service.dart';
import 'package:package_info/package_info.dart';

class GCSettingController extends GetxController {
  UserService userService = Get.find();

  List<String> images = [
    R.assetsIconSettinglogout,
    R.assetsIconSettingpwd,
    R.assetsIconSettingaddress,
    R.assetsIconSettingfp,
    R.assetsIconSettingkf,
    R.assetsIconSettingclean,
  ];

  List<String> titles = [
    "退出账号",
    "更改密码",
    "地址管理",
    "发票管理",
    "客服服务",
    "清除缓存",
  ];

  String getVersion() {
    return GCContainer.instance.config.packageInfo.version;
  }

  didSelectedIndex(int index) {
    log(index.toString());
    if (index == 0) {
      GCMineController mine_c = Get.find();
      mine_c.clearUserDara();

      userService.removeUserInfo();
      Get.back();
    } else if (index == 1) {
      Get.toNamed(Routes.EDITPASSWORD);
    } else if (index == 2) {
      Get.toNamed(Routes.ADDRESS);
    } else if (index == 3) {
      Get.toNamed(Routes.INVOICE);
    } else if (index == 4) {
      Get.toNamed(Routes.KF);
    }
  }
}
